package com.wzh.live.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.wzh.live.entity.LivrOrderEntity;
import com.wzh.live.service.LivrOrderService;
import com.wzh.common.utils.PageUtils;
import com.wzh.common.utils.R;



/**
 * 
 *
 * @author wzh
 * @email 1281204121@qq.com
 * @date 2022-03-28 17:09:10
 */
@RestController
@RequestMapping("live/livrorder")
public class LivrOrderController {
    @Autowired
    private LivrOrderService livrOrderService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = livrOrderService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{liveOrderId}")
    public R info(@PathVariable("liveOrderId") Integer liveOrderId){
		LivrOrderEntity livrOrder = livrOrderService.getById(liveOrderId);

        return R.ok().put("livrOrder", livrOrder);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody LivrOrderEntity livrOrder){
		livrOrderService.save(livrOrder);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody LivrOrderEntity livrOrder){
		livrOrderService.updateById(livrOrder);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] liveOrderIds){
		livrOrderService.removeByIds(Arrays.asList(liveOrderIds));

        return R.ok();
    }

}
